home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / vidhrdw / dotrikun.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  2KB  |  84 lines

  1. /***************************************************************************
  2.  
  3. Dottori Kun (Head On's mini game)
  4. (c)1990 SEGA
  5.  
  6. Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/12/15 -
  7.  
  8. ***************************************************************************/
  9.  
  10. #include "driver.h"
  11. #include "vidhrdw/generic.h"
  12.  
  13.  
  14.  
  15. /*******************************************************************
  16.  
  17.     Palette Setting.
  18.  
  19. *******************************************************************/
  20. WRITE_HANDLER( dotrikun_color_w )
  21. {
  22.     int r, g, b;
  23.  
  24.     r = ((data & 0x08) ? 0xff : 0x00);
  25.     g = ((data & 0x10) ? 0xff : 0x00);
  26.     b = ((data & 0x20) ? 0xff : 0x00);
  27.     palette_change_color(0, r, g, b);        // BG color
  28.  
  29.     r = ((data & 0x01) ? 0xff : 0x00);
  30.     g = ((data & 0x02) ? 0xff : 0x00);
  31.     b = ((data & 0x04) ? 0xff : 0x00);
  32.     palette_change_color(1, r, g, b);        // DOT color
  33. }
  34.  
  35.  
  36. /*******************************************************************
  37.  
  38.     Draw Pixel.
  39.  
  40. *******************************************************************/
  41. WRITE_HANDLER( dotrikun_videoram_w )
  42. {
  43.     int i;
  44.     int x, y;
  45.     int color;
  46.  
  47.  
  48.     videoram[offset] = data;
  49.  
  50.     x = 2 * (((offset % 16) * 8));
  51.     y = 2 * ((offset / 16));
  52.  
  53.     if (x >= Machine->drv->visible_area.min_x &&
  54.             x <= Machine->drv->visible_area.max_x &&
  55.             y >= Machine->drv->visible_area.min_y &&
  56.             y <= Machine->drv->visible_area.max_y)
  57.     {
  58.         for (i = 0; i < 8; i++)
  59.         {
  60.             color = Machine->pens[((data >> i) & 0x01)];
  61.  
  62.             /* I think the video hardware doubles pixels, screen would be too small otherwise */
  63.             plot_pixel(Machine->scrbitmap, x + 2*(7 - i),   y,   color);
  64.             plot_pixel(Machine->scrbitmap, x + 2*(7 - i)+1, y,   color);
  65.             plot_pixel(Machine->scrbitmap, x + 2*(7 - i),   y+1, color);
  66.             plot_pixel(Machine->scrbitmap, x + 2*(7 - i)+1, y+1, color);
  67.         }
  68.     }
  69. }
  70.  
  71.  
  72. void dotrikun_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh)
  73. {
  74.     if (palette_recalc() || full_refresh)
  75.     {
  76.         int offs;
  77.  
  78.         /* redraw bitmap */
  79.  
  80.         for (offs = 0; offs < videoram_size; offs++)
  81.             dotrikun_videoram_w(offs,videoram[offs]);
  82.     }
  83. }
  84.